<template>
  <div class="headBar relative">
    <div class="headerBar-content pc-width">
      <img :src="src" alt="">
      <ul class="header-nav" :class="{'blue': theme}">
        <li  v-for="(item, index) in nav" :key="index" :class="{'current': $route.fullPath.includes(`${item.link}`)}" @click="selectItem(item, index)">{{item.name}}</li>
      </ul>
    </div>
  </div>
</template>

<script>
// import { tracker } from 'lib/analytics'
export default {
  name: "headBar",
  computed: {
    theme () {
      return this.$route.fullPath.includes("home") || this.$route.fullPath.includes("installer") || this.$route.fullPath.includes("serve")
    },
    src () {
      return this.$route.fullPath.includes("installer") ? require('../../assets/icon/logo2.png') : require('../../assets/icon/logo.png')
    }
  },
  data () {
    return {
      currentIndex: 0,
      nav: [{
        name: '首页',
        path: '/home',
        link: '/home'
      }, {
        name: '关于协会',
        path: '/association',
        link: '/association/'
      }, {
        name: '政策法规',
        path: '/regulations',
        link: '/regulations/'
      }, {
        name: '党建联建',
        path: '/party',
        link: '/party/'
      }, {
        name: '会员中心',
        path: '/vip',
        link: '/vip/'
      }, {
        name: '创优评先',
        path: '/innovation',
        link: '/innovation/'
      }, {
        name: '科技委',
        path: '/expert',
        link: '/expert/'
      }, {
        name: '行业培训',
        path: '/train',
        link: '/train/'
      }, {
        name: '服务平台',
        path: '/serve',
        link: '/serve'
      }, {
        name: '下载专区',
        path: '/down',
        link: '/down/'
      }]
    }
  },
  components: {
  },
  mounted () {
  },
  created () {
  },
  methods: {
    selectItem (item, index) {
      this.currentIndex = index
      this.$router.push({ path: item.path })
    }
  }
}

</script>

<style lang="scss">
</style>
